﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public class EK03Report : BaseReport
    {
        string strCompany = "HLT";
        string strExcelFile = "";
        public EK03Report()
            : base()
        {
            AssignColumns();
        }
        public EK03Report(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        {
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
            AssignColumns();
        }
        private void AssignColumns()
        {
            columns.Clear();
            columns.Add("CODE"); columns.Add("ART"); columns.Add("VAR"); columns.Add("DES"); columns.Add("FARBE");
            columns.Add("COLOR"); columns.Add("AUFKRS"); columns.Add("AUFLFD"); columns.Add("AUFPOS"); columns.Add("LIEFNR");
            columns.Add("SUPPLIER"); columns.Add("ORDERQTY"); columns.Add("UNIT"); columns.Add("PRICE");
            columns.Add("ORDERDATE"); columns.Add("STARTDATE"); columns.Add("ENDDATE"); columns.Add("INCOMEDATE");
            columns.Add("BATCH"); columns.Add("SUPPLIERBATCH"); columns.Add("WEI"); columns.Add("DIFF");
            columns.Add("DIFF1");

        }

        public void REPORT2EXCEL(string fileType)
        {
            Queue CellQueue = new Queue(); 
            string filename = "";
            string sheetName = "";
            string Standard = "Purchase_Material_PO";
            strExcelFile = @"HLT\HLTSummaryReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = "";
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Purchase\采购原料报表" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["EKPOS"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        } 
        
    }
    }


